def check_passwd(passwd):
    def check_len(passwd):
        if len(passwd) > 8:
            return 1
        else:
            return 0
    def check_case(passwd):
        low = 0
        upper = 0
        num = 0
        other = 0
        for i in passwd:
            if 'a' <= i <= 'z':
                low = 1
            elif 'A' <= i <= 'Z':
                upper = 1
            elif '0' <= i < '9':
                num = 1
            else:
                other = 1
        if low + upper + num + other >= 3:
            return 1
        else:
            return 0
    def check_substr(passwd):
        for i in range(len(passwd)):
            if passwd.count(passwd[i:i + 3]) >= 2:
                return 0
            else:
                return 1
    result=[]
    a = check_len(passwd)
    if a==0:
        result.append("长度小于8")
    b = check_case(passwd)
    if b==0:
        result.append("密码没有三种以上的字字符组成")
    c = check_substr(passwd)
    if c==0:
        result.append("密码有长度超过或等于3的子串重复")
    if a+b+c==3:
        result.append("密码设置合法")
    print(f"密码综合评分为{2+a+b+c},{result}")

while 1:
    passwd =input("输入一个密码：")
    check_passwd(passwd)

